package com.zky.gulimall.order.service;

import com.alipay.api.AlipayApiException;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zky.common.to.mq.SecKillOrderTo;
import com.zky.common.utils.PageUtils;
import com.zky.gulimall.order.entity.OrderEntity;
import com.zky.gulimall.order.vo.*;

import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author zky
 * @email 574096634@qq.com
 * @date 2022-08-18 21:46:46
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 确认订单页返回的数据
     *
     * @return
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    /**
     * 创单
     *
     * @param submitVo
     * @return
     */
    OrderSubmitResponseVo submitOrder(OrderSubmitVo submitVo);

    /**
     * 根据订单id查询订单信息
     *
     * @param orderSn
     * @return
     */
    OrderEntity getOrderByOrderSn(String orderSn);

    /**
     * 关闭订单
     *
     * @param orderEntity
     */
    void closeOrder(OrderEntity orderEntity);

    //获取订单支付信息
    PayVo getPayOrder(String orderSn);

    PageUtils queryPageWithItem(Map<String, Object> params);

    /**
     * 处理支付宝支付成功消息
     *
     * @param asyncVo
     * @return
     */
    String handlePayResult(PayAsyncVo asyncVo);

    /**
     * 支付宝验签
     * @param request
     * @return
     */
    Boolean checkSign(HttpServletRequest request) throws UnsupportedEncodingException, AlipayApiException;

    /**
     * 创建秒杀订单
     * @param secKillOrderTo
     */
    void createSecKillOrder(SecKillOrderTo secKillOrderTo);
}

